#include <memory>

#include "localcommon.hpp"
#include "localtcpserver.hpp"

int main(int argc, char *argv[])
{
    if (argc != 2)
    {
        SerErr();
        exit(ERR_SER);
    }
    uint16_t tcp_port = std::stoi(argv[1]);

    // 建立守护进程
    //::daemon(0, 0);

    std::shared_ptr<Local_Connection::LocalConnection> listenconn = std::make_shared<Local_Connection::LocalListener>(tcp_port);

    std::unique_ptr<Local_Tcp::TcpServer> ma_server = std::make_unique<Local_Tcp::TcpServer>();
    ma_server->AddConnection(listenconn);
    ma_server->Start();

    return 0;
}
